<link href="../core/resource/css/style.css" rel="stylesheet">
<style>
.panel-default {
	border-color:rgb(231, 231, 235);
	border:0 solid #d9d9d9;
	min-height: 128px;
}
.panel-default>.panel-heading {
	color:#333;
	background-color:rgb(246, 248, 249);
	border-color:#d9d9d9
}
</style>
<div class="col-jy" style="width:100%;padding:100px">
	<div class="col-jy-12">
		<div class="form-group-title">
			经营概况
		</div>
		<div class="form-group">
			<div class="btn-group site-tp-group" style="float: left;">
				<a ng-class="{'btn': 1,'active': pagedata.params.daytype ==0}" ng-click="pagedata.params.daytype=0;pagedata.getdata();">今日</a>
				<a ng-class="{'btn': 1,'active': pagedata.params.daytype ==1}" ng-click="pagedata.params.daytype=1;pagedata.getdata();">昨日</a>
				<a ng-class="{'btn': 1,'active': pagedata.params.daytype ==2}" ng-click="pagedata.params.daytype=2;pagedata.getdata();">7日</a>
				<a ng-class="{'btn': 1,'active': pagedata.params.daytype ==3}" ng-click="pagedata.params.daytype=3;pagedata.getdata();">汇总</a>
			</div>
			<div class="form-group" style="width:15%;float: left;">
				<div class="col-xs-12 col-sm-12 col-lg-12" style="padding-left:5px;padding-right:5px">
					<button class="btn btn-gray daterange daterange-date" id="daterange-date-time" ng-init="pagedata.time_range(pagedata.params,'time','daterange-date-time',false,true)" type="button"><span class="date-title">至</span> <i class="fa fa-calendar"></i></button>
				</div>
			</div>
		</div>
	</div>
	<div class="col-jy-12">
		<div class="col-jy-6">
			<div class="panel panel-default" style="background:#e8fcf8;">
			<div class="panel-heading" style="background:#15a589;">
				<h4 class="panel-title t-c" style="color:#fff">支付数据</h4>
			</div>
			<div class="panel-body">
				<div class="panel-stat">
                    <div class="panel-stat-btn">
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付订单数(笔)</div>
								<div class="bold">{{pagedata.data.paybi|| '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.paybi2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付人数(人)</div>
								<div class="bold">{{pagedata.data.payren|| '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.payren2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付金额(元)</div>
								<div class="bold">{{pagedata.data.payyuan|| '0.00'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.payyuan2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付商品数(件)</div>
								<div class="bold">{{pagedata.data.payjian|| '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.payjian2|| '-'}}</div>
						</div>
						</div>
                    </div>
				</div>
			</div>
			</div>
		</div>
		<div class="col-jy-6">
			<div class="panel panel-default" style="background:#fff7e9;">
			<div class="panel-heading" style="background:#fc9f4c;">
				<h4 class="panel-title t-c" style="color:#fff">收益数据</h4>
			</div>
			<div class="panel-body">
				<div class="panel-stat">
                    <div class="panel-stat-btn">
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付订单数(笔)</div>
								<div class="bold">{{pagedata.data.shoubi || '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.shoubi2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付人数(人)</div>
								<div class="bold">{{pagedata.data.shouren || '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.shouren2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付金额(元)</div>
								<div class="bold">{{pagedata.data.shouyuan || '0.00'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.shouyuan2|| '-'}}</div>
						</div>
						</div>
						<div class="col-sm-6">
						<div class="text-center">
								<div class="bold">支付商品数(件)</div>
								<div class="bold">{{pagedata.data.shoujian || '0'}}</div>
								<div style="color:#999">较7日前{{pagedata.data.shoujian2|| '-'}}</div>
						</div>
						</div>
                    </div>
				</div>
			</div>
			</div>
		</div>
	</div>
	<!--<div class="col-jy-12">
		<div class="form-group-title">
			趋势概况
		</div>
		<ul class="nav nav-tabs">
		<li ng-class="{'active':pagedata.params.qushi==0}">
			<a href="javascript:;" ng-click="pagedata.params.qushi=0;pagedata.getdata();">支付数据</a>
		</li>
		<li ng-class="{'active':pagedata.params.qushi==1}">
			<a href="javascript:;" ng-click="pagedata.params.qushi=1;pagedata.getdata();">收益数据</a>
		</li>
		</ul>
		<div class="form-group">
			<div class="btn-group site-tp-group" style="float: left;">
				<a ng-class="{'btn': 1,'active': pagedata.params.qushitype ==0}" ng-click="pagedata.params.qushitype=0;pagedata.getdata();">今日</a>
				<a ng-class="{'btn': 1,'active': pagedata.params.qushitype ==1}" ng-click="pagedata.params.qushitype=1;pagedata.getdata();">昨日</a>
				<a ng-class="{'btn': 1,'active': pagedata.params.qushitype ==2}" ng-click="pagedata.params.qushitype=2;pagedata.getdata();">7日</a>
			</div>
		</div>
	</div>
	<div class="col-jy-12">
	</div>
	-->
</div>
<script language='javascript'>
scope.pagedata.getdata=function(){
	console.log('11222');
    var params=scope.pagedata.params;
	params.time=params.time?params.time:{}
	params.time.tstart=params.time.tstart?params.time.tstart:0;
	params.time.tend=params.time.tstart?params.time.tstart:0;
	scope.get('jy_mfuwu/manage.index/getdata/daytype='+params.daytype+'&tstart='+params.time.tstart+'&tend='+params.time.tend,function(res){
		console.log(res.params);
		scope.pagedata.data=res.data;
		scope.$evalAsync();
	});
}
scope.pagedata.getdata();
scope.pagedata.time_range=function(to,field,id,read,no_time_pic){
		//console.log('触发time_range');console.log(id);
		
		require(["daterangepicker"], function($){
				$("#"+id).each(function(){
					var elm = this;
					var dt=new Date();
					var date_str=scope.date(parseInt(dt.getTime()/1000),true);
					date_str=date_str.split(' ')[0];
					var start_Date=date_str+' 00:00';
					var end_Date=date_str+' 23:59';
					start_Date='';end_Date='';
					var startDate=new Date();var endDate=new Date();
					if(to[field]){
						if(to[field].tstart){
							start_Date=scope.date(to[field].tstart,true);
							startDate=new Date(to[field].tstart * 1000);
						}
						if(to[field].tend){
							end_Date=scope.date(to[field].tend,true);
							endDate=new Date(to[field].tend * 1000);
						}
					}
					if(start_Date || end_Date){
						$(elm).find(".date-title").html(start_Date + " 至 " + end_Date);
					}else{
						$(elm).find(".date-title").html("点击设置时间段");
					}
					
					$(this).daterangepicker({
						startDate: startDate,
						endDate: endDate,
						timePicker:no_time_pic?false:true,
						timePickerIncrement:5,
						timePicker12Hour:false,
					}, function(start, end){
						$(elm).find(".date-title").html(start.toDateTimeStr() + " 至 " + end.toDateTimeStr());
						to[field]={'tstart':start.unix(),'tend':end.unix()};
						scope.pagedata.getdata();
						scope.$evalAsync();
					});
				});
		});
	}
</script>